import webpack from 'webpack';
import config from './config.js';

if (process.env.NODE_ENV === undefined) {
  console.log('[云组件-Error]: 启动Server需要提供NODE_ENV变量，请确认你所运行的脚本是否正确？');
  process.exit(0);
}

webpack(config('production')).run((stat, compiler) => {
  if (compiler.compilation.errors.length) {
    console.log('[云组件-Error]：Build失败！发现以下问题请解决后重试！');
    console.log(compiler.compilation.errors);
  } else {
    console.log('[云组件]：Build完成！');
  }
});
